// components/rgb/rgb.js
Component({
  properties: {},

  data: {
    color: {
      r: 0,
      g: 0,
      b: 0,
    },
    fullColor: "0,0,0",
  },

  observers: {
    "color.r,color.g,color.b": function (a, b, c) {
      // console.log(a, b, c);
      this.setData({
        fullColor: `${a},${b},${c}`,
      });
    },
  },
  methods: {
    itemClick(e) {
      let type = e.currentTarget.dataset.type;
      console.log(type)
      // return;
      this.data.color[type] += 20;
      if (this.data.color[type] > 255) {
        return false
      }
      this.setData({ 
        color: this.data.color
      })
    },

  },

});